package com.honeycomb.common.logger;

import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.LogManager;
import org.apache.log4j.xml.DOMConfigurator;

public class HoneyCombLoggerFactory {
	
	public static HoneyCombLogger getLogger(Class className){
		return new HoneyCombLogger(LogManager.getLogger(className));
	}
	
	public static HoneyCombLogger getLoggerForJunit(Class className){
		if(!junitLoggerSwitch){
			loadConfig();
		}
		return new HoneyCombLogger(LogManager.getLogger(className));
	}
	
	private static boolean junitLoggerSwitch = false;
	private static void loadConfig(){
		try{
			DOMConfigurator.configure(HoneyCombLoggerFactory.class.getResource("com/honeycomb/resource/log4j.xml"));
		}catch(Exception ex){
			BasicConfigurator.configure();
		}
	}
	
	
	
}
